package com.tiny.mirror.service.product.interfaces.controller;

import com.api.tiny.mirror.service.product.ShoppingApiService;
import com.api.tiny.mirror.service.product.response.ShoppingAppDetailVO;
import com.api.tiny.mirror.service.product.response.ShoppingAppVO;
import com.tiny.mirror.basic.common.enums.AccessTypeEnum;
import com.tiny.mirror.basic.web.dto.response.BasePageResponse;
import com.tiny.mirror.basic.web.dto.response.BaseResponse;
import com.tiny.mirror.basic.web.interceptor.annotation.SessionRequired;
import com.tiny.mirror.service.product.application.query.AppQryService;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: liujsh
 * @Description:
 * @Date: Create in 2023/9/25
 */
@RestController
public class ShoppingController implements ShoppingApiService {

  @Resource
  private AppQryService appQryService;


  @SessionRequired(
      accessType = AccessTypeEnum.OUTER,
      menuPerms = "product:shopping:query"
  )
  @Override
  public BasePageResponse<ShoppingAppVO> getAppList() {
    return appQryService.pageDashboardApp();
  }

  @SessionRequired(
      accessType = AccessTypeEnum.OUTER,
      menuPerms = "product:shopping:query"
  )
  @Override
  public BaseResponse<ShoppingAppDetailVO> getApp(@RequestParam(value = "id") Long id) {
    return BaseResponse.success(appQryService.getDashboardAppDetail(id));
  }
}
